<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 鸡兔同笼
        let head = 35
        let foot = 94
        let result = [0,0]
        for (let chicken = 0;  chicken<head; chicken++) {
            let ribbit = head-chicken;
            if(2*chicken+4*ribbit ===foot&&ribbit>=0){
                result[0]=chicken
                result[1]=ribbit
                break
            }     
        }
        console.log('鸡有'+result[0]+'只，鸡有'+result[1]+'只');


        // 兔子数量
        let you = 1//幼兔
        let small = 0//小兔
        let big = 0//成兔
        for (let i = 0;  i<10; i++) {
            if(i==1){
                // 第一个月不操作
            }else{
                // 上个月小兔变成兔
                big+=small
                // 上个月幼兔变小兔
                small=you
                // 成兔生幼兔3
                .z
                you=big
            }
        }
        console.log('幼'+you);
        console.log('小'+small);
        console.log('成'+big);
        

        // 猴子吃桃
        let peach = 1
        for (let day = 2; day <=7 ; day++) {
            peach = (peach+1)*2        
        }
       console.log(peach);


        //斐波那契数列
        // let first = 0 
        // for (let e = 0; e <max.length; e++) {
        //     if()
            
        // }

        // 数组去重
        let arr = [7,8,5,6,2,4,5,6,5,4,1,5,8,5,4,1,2,5,4]
        let newarr = []
        for (let index = 0; index < arr.length; index++) {
            // 遍历所有元素
            // 通过indexOf判断是否在新数组中存在
            // 如果返回-1不存在
            // push到新数组中
            if(newarr.indexOf(arr[index])==-1){
                newarr.push(arr[index])
            }
        }
            console.log(newarr);
            


        // 求1-用户输入的数之间所有能被3和7整除的数的和
        let input = prompt('请输入')
        let max = parseInt(input)

        let conform = []
        let sum = 0
        for (let i = 1; i<= max; i++) {
            if(i%21===0){
            conform.push(i)
            sum += i
            }
        }
        if(input.length===0){
            document.write('您输入的数没有能同时被3和7同时整除的')
        }
        else{
            document.write('这些数的和是'+sum)
        }
        
    </script>
</body>
</html>